package com.CGFrame.struts.action.pOperate;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.CGFrame.struts.POJOs.Make;
import com.CGFrame.struts.POJOs.Makerelation;
import com.CGFrame.struts.bean.ProjectOperate;
import com.CGFrame.struts.bean.log.LogHistoryBean;
import com.CGFrame.struts.bean.pOperate.pOperateBean;

/** 
 * MyEclipse Struts
 * Creation date: 06-17-2007
 * 
 * XDoclet definition:
 * @struts.action scope="request"
 */
public class DelAction extends Action {
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		// TODO Auto-generated method stub
		String fatherType = request.getParameter("FatherType");
		String fatherId = request.getParameter("FatherId");
		String id = request.getParameter("Id");
		String type = request.getParameter("Type");
		pOperateBean popb = new pOperateBean();
		popb.DeleteUnit(type, id);
		
		LogHistoryBean logBean = new LogHistoryBean();
		String regUserId = (String)request.getSession().getAttribute("RegUserID");
		logBean.saveByReguserId(regUserId, LogHistoryBean.DELETE,null, type, Integer.parseInt(id) );
		
		request.setAttribute("Type", fatherType);
		request.setAttribute("ObjectID", fatherId);
		
		return (mapping.findForward("deleted"));
	}
}